import Vue from "vue";
import VueRouter from 'vue-router';
Vue.use(VueRouter);

const routes = [
  {
    path:"/",
    redirect:'/home'
  },
  {
    path: "/home",
    name: "Home",
    component: () => import("@app1/views/Home.vue"),
  },
  {
    path: "/login",
    name: "Login",
    component: () => import("@app1/views/Login.vue")
  }
];

const router = new VueRouter({
  routes
});

//注册一个全局前置守卫,确保要调用 next 方法，否则钩子就不会被 resolved
router.beforeEach((to, from, next) => {
  next();
});

export default router;
